<?php

class Application_Form_ResetPassword extends Zend_Form
{

    public function init()
    {
        /* Form Elements & Other Definitions Here ... */
		$this->setName('resetPassword');
		$this->setMethod('post');
		$this->setAction('/');
		$this->setAttrib('class', 'mod-reset-pwd');
		$this->setDecorators(array('FormElements','Form'));
		
		$decorators = array('ViewHelper', array('Errors', array('escape' => false)), array('Label', array('escape' => false)), 'DtDdWrapper');
		
		// Campo Password
		$pswd = new Zend_Form_Element_Password('pwd');
        $pswd->setAttrib('size', 30);
        $pswd->setDecorators($decorators);
        //$pswd->getDecorator('Label')->setOption('escape',false);
		$pswd->setLabel(htmlentities('Contraseña:',ENT_QUOTES, "UTF-8"));
        //Validate
        $pswd->setRequired(true);
        $pswd->addFilter(new Zend_Filter_StringTrim());
        $pswd->addValidator('StringLength', false, array(6,15));
        $pswd->addErrorMessage('Por favor elija un password de entre 6 y 15 caracteres');

		// Campo Repetir Password
		$pswd2 = new Zend_Form_Element_Password('pwd-confirm');
        //$pswd2->setAttrib('placeholder', 'Vuelva a escribir su contrase&ntilde;a');
        $pswd2->setAttrib('size', 30);
        $pswd2->setDecorators($decorators);
		//$pswd2->getDecorator('Label')->setOption('escape',false);
		$pswd2->setLabel(htmlentities('Confirma Contraseña:',ENT_QUOTES, "UTF-8"));
        //Validate
        $pswd2->setRequired(true);
        $pswd2->addValidator(new Zend_Validate_Identical('pwd'));
		//$pswd2->getDecorator('Errors')->setOption('escape',false);
		$pswd2->addErrorMessage(htmlentities('Las contraseñas no coinciden',ENT_QUOTES, "UTF-8"));

		
		
		// Botón enviar
		$enviar = new Zend_Form_Element_Submit('Cambiar');
		
		// Agregamos los campos al formulario
		$this->addElements(array($pswd,$pswd2,$enviar));
    }


}

